package common.util;

import edu.stanford.nlp.pipeline.StanfordCoreNLP;

import java.util.Properties;

/**
 * 斯坦福词形还原测试，及两个句子的相似度计算。
 * 贾新志 2023.03.13
 */

public class SingletonLemma {


    private static volatile SingletonLemma instance = null;
    private StanfordCoreNLP pipeline;

    private SingletonLemma() {
        Properties properties = new Properties();
        //分词、分句、词性标注和次元信息。
        properties.put("annotators", "tokenize,ssplit,pos,lemma");
        this.pipeline = new StanfordCoreNLP(properties);
    }

    public static synchronized SingletonLemma getInstance() {
        if (instance == null) {
            instance = new SingletonLemma();
        }
        return instance;
    }

    public StanfordCoreNLP getPipeline() {
        return pipeline;
    }


}
